﻿using System;

public class Student
{
    private int classNumber;
    private string gender;
    private string name;
    private string ssn;

    public Student(string gender, string name, int classNumber, string ssn)
    {
        CheckInputData(gender, name, classNumber, ssn);
        this.gender = gender;
        this.name = name;
        this.classNumber = classNumber;
        this.ssn = ssn;
    }

    public int ClassNumber
    {
        get
        {
            return classNumber;
        }
        set
        {
            CheckClassNumber(value);
            classNumber = value;
        }
    }

    public string Gender
    {
        get
        {
            return gender;
        }
        set
        {
            CheckGender(value);
            gender = value;
        }
    }

    public string Name
    {
        get
        {
            return name;
        }
        set
        {
            CheckName(value);
            name = value;
        }
    }

    public string Ssn
    {
        get
        {
            return ssn;
        }
        set
        {
            ssn = value;
        }
    }

    private void CheckClassNumber(int classNumber)
    {
        if (classNumber < 1 || classNumber > 11)
        {
            throw new ArgumentException("Classnumber must be between 1 and 11");
        }
    }

    private void CheckGender(string gender)
    {
        if (!gender.Equals("male") && !gender.Equals("female"))
        {
            throw new ArgumentException("Gender should be male or female");
        }
    }

    private void CheckInputData(string gender, string name, int classNumber, string ssn)
    {
        CheckGender(gender);
        CheckName(name);
        CheckClassNumber(classNumber);
        CheckSsn(ssn);
    }
  
    private void CheckSsn(string ssn)
    {
        if (ssn.Length != 9)
        {
            throw new ArgumentException("SSN must be 9 digits");
        }
    }

    private void CheckName(string name)
    {
        if (name.Length < 10 || name.Length > 50)
        {
            throw new ArgumentException("Name's length should be between 10 and 50");
        }
    }
}